package com.by.component.extra.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum ExtraInfoTypeEnum {

    ORDER_BELONG(ExtraInfoTypeEnum.ORDER_BELONG_CODE, "订单归属"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, ExtraInfoTypeEnum> MAP = Arrays.stream(ExtraInfoTypeEnum.values())
            .collect(Collectors.toMap(ExtraInfoTypeEnum::getCode, Function.identity()));

    public static ExtraInfoTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int ORDER_BELONG_CODE = 1;

}
